FROM mcr.microsoft.com/dotnet/framework/sdk:4.7.2 AS build
WORKDIR /app

# COPY set-proxy.ps1 .

# set proxy
RUN powershell.exe -command Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Internet-Settings" -Name ProxyServer -Value "http://ex_gaomeng:gaomeng.320@10.68.211.5:80/"

# copy csproj and restore as distinct layers
COPY *.sln .
COPY WebFormAppNet40/*.csproj ./WebFormAppNet40/
COPY WebFormAppNet40/*.config ./WebFormAppNet40/
RUN nuget restore

# copy everything else and build app
COPY WebFormAppNet40/. ./WebFormAppNet40/
WORKDIR /app/WebFormAppNet40
RUN msbuild /p:Configuration=Release


FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2 AS runtime
WORKDIR /inetpub/wwwroot
COPY --from=build /app/WebFormAppNet40/. ./
